package com.itheima.dubbo.samples.echo;

import com.itheima.dubbo.samples.api.EchoService;
import com.itheima.dubbo.samples.provider.EchoServiceImpl;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.ServiceConfig;

import java.io.IOException;

public class EchoProvider {

    public static void main(String[] args) throws IOException {

        ServiceConfig<EchoService> service = new ServiceConfig<>();
        service.setApplication(new ApplicationConfig("java-echo-provider"));
        service.setRegistry(new RegistryConfig("zookeeper://192.168.56.100:2181"));
        service.setInterface(EchoService.class);
        service.setRef(new EchoServiceImpl());
        service.export();   //暴露服务
        System.out.println("java-echo-provider is running");
        System.in.read();
    }
}
